import request, { IResposeItem } from "@/configs/request"
import { to } from "@/utils"
// 登录
/**
    get
 */
export const get11 = (id: string) => {
  return request.get("/sdfdsfds", { params: { id } })
}


type IResposeWithNull<R> = {
  [K in keyof R]?: R[K] | null | undefined
}


export interface ILoginparmas {
  phone: string
  loginPwd: string
  hospitalUuid: string
  deviceType: number
}

export interface IRoute2 {
  url: string;
  menuName: string;
  menuType: string;
  routes: any[];
}

export interface IRoute {
  url: string;
  menuName: string;
  menuType: string;
  routes: IRoute[];
}

export interface IMenu extends IRoute {
  url: string;
  menuName: string;
  menuType: string;
  routes: IRoute[];
}

export interface ILoginOut extends IMenu {
  id: number;
  userId: string;
  token: string;
  hospitalUuid: string;
  hospitalId: number;
  employeeId?: any;
  name: string;
  nickName?: any;
  sex: number;
  birthday?: any;
  idCard?: any;
  contactPhone: string;
  emailAddress?: any;
  status: number;
  statusDes: string;
  mainDeptId: number;
  deptName: string;
  jobTitle?: any;
  photo?: any;
  signature?: any;
  lastLoginTime?: any;
  profession?: any;
  description?: any;
  expand?: any;
  perms: string[];
  menus: IMenu[];
}


/**
 * 医生用户请求登录
 */
export const login = async (parmas: ILoginparmas): Promise<[any, IResposeItem<ILoginOut>]> => {
  return to<IResposeItem<ILoginOut>>(request.post("/sys/user/login", parmas, { headers: { Authorization: "" } }))
}
